/**
 * @param {number[]} prices
 * @return {number}
 */
 var maxProfit = function(prices) {
    let len = prices.length,count=0
    for(let i=0;i<len;i++){
        if(i>0&&prices[i]>prices[i-1]){
            count+=prices[i]-prices[i-1]
        }
    }
    return count
};
console.log(maxProfit([7,1,5,3,6,4]));